package com.zfh.iterator;

public class StudentGroupIterator implements Iterator {
	
	private StudentGroup studentGroup;
	private int index;
	
	public StudentGroupIterator(StudentGroup studentGroup) {
		this.studentGroup = studentGroup;
		this.index = 0;
	}

	@Override
	public boolean hasNext() {
		if(index<studentGroup.getLength()) {
			return true;
		} else {
			return false;
		}
	}

	@Override
	public Object next() {
		Student student = studentGroup.getStudentAt(index);
		index++;
		return student;
	}

}
